package com.qian.ddj.register.controller;

import com.qian.api.ddj.register.model.ShRegister;
import com.qian.api.ddj.register.service.IShRegisterService;
import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("ddj/register/sh")
@Api(tags = "SH报件")
public class ShRegisterController {

    @Autowired
    private IShRegisterService shRegisterService;

    @GetMapping("/{groupId}")
    @ApiOperation("查询报件列表")
    public PageResp<ShRegister> list(PageReq pageReq, @PathVariable Integer groupId) {
        ShRegister shRegister = new ShRegister();
        shRegister.setGroupId(groupId);
        PageResp<ShRegister> page = shRegisterService.findAll(shRegister, pageReq);
        return page;
    }

    @PostMapping
    @ApiOperation("报件")
    public ShRegister save(ShRegister shRegister) {
        return shRegisterService.save(shRegister);
    }
}
